home *** CD-ROM | disk | FTP | other *** search
/ Aminet 44 / Aminet 44 (2001)(GTI - Schatztruhe)[!][Aug 2001].iso / Aminet / game / patch / WHD_FrostByte.lha / WHD_FrostByte / Install < prev    next >
Text File  |  2001-05-29  |  7KB  |  291 lines

  1. ;================================================================================
  2. ; CONFIGURATION SECTION
  3.  
  4. (set #CFG_APPNAME "Frost Byte")
  5. (set #CFG_APPGUI  "Frost Byte")
  6. (set #CFG_APPSLV  "FBHD")
  7. (set #CFG_APPVER  "R0501.1")
  8. (set #CFG_APPCOPY "2001")
  9.  
  10. ;================================================================================
  11.  
  12. ;------------------------------------------------------------------------------------
  13. ; Checks if given program is reachable via the path, if not abort install
  14. ;
  15. ; Entry:    #VP1 = name of program to search for
  16.  
  17. (procedure P_CheckRun (
  18.     (if (<> 0 (run (cat "Which " #VP1)))(
  19.         (abort
  20.             (cat
  21.                 "Could not find the program\n\n"
  22.                 "'" #VP1 "'\n\n"
  23.                 "which is required to perform the installation!\n\n"
  24.                 "Please install the '" #VP1 "' program ensuring that"
  25.                 " it is accessible on the path, then try the installation again."
  26.             )
  27.         )
  28.     ))
  29. ))
  30.  
  31.  
  32. ;------------------------------------------------------------------------------------
  33. ; Create installation directories if required
  34.  
  35. (procedure P_InstallDirs (
  36.     ;
  37.     ; Create data dir if required
  38.     ;
  39.     (if (<> 2 (exists #VDATDIR))(
  40.         (makedir #VDATDIR
  41.             (prompt "The directory '" #VDATDIR "' will now be created")
  42.             (help @makedir-help)
  43.             (confirm)
  44.         )
  45.     ))
  46. ))
  47.  
  48.  
  49. ;------------------------------------------------------------------------------------
  50. ; Determine and set information about version of game being installed
  51. ;
  52.  
  53. (procedure P_SetVersionInfo (
  54.     ; if the file exists, set version information
  55.     (if (<= #VVERINFA 0)(
  56.         (if (= 1 (exists #VDATFILE))(
  57.             ; determine version from CRC
  58.             (working "Determining game version")
  59.  
  60.             (set #VT1 (getsum #VDATFILE))
  61.  
  62.             (set #VVERINFA 0)
  63.             (if (= #VT1 -759283923) (set #VVERINFA 1))
  64.         ))
  65.     ))
  66. ))
  67.  
  68.  
  69. ;------------------------------------------------------------------------------------
  70. ; Make game data
  71.  
  72. (procedure P_InstallGame (
  73.     ;
  74.     ; Set path to game data file
  75.     ;
  76.     (set #VDATFILE (tackon #VDATDIR ".prg"))
  77.  
  78.     ;
  79.     ; Install data files if not found or unknown versions
  80.     ;
  81.     (P_SetVersionInfo)
  82.     (if (<= #VVERINFA 0)(
  83.         ;
  84.         ; Tell user what is happening
  85.         ;
  86.         (message
  87.             (cat
  88.                 "\n\n\nThe installer will now create the game data files\n"
  89.                 "Please insert your game disk in drive DF0:\n\n"
  90.                 "Click 'Proceed' when ready."
  91.             )
  92.         )
  93.  
  94.         ;
  95.         ; Call the imager slave
  96.         ;
  97.         (working "Creating data files in '" #VDATDIR "'")
  98.  
  99.         (copyfiles
  100.             (prompt "Copying game files to '" #VDATDIR "'")
  101.             (help @copyfiles-help)
  102.             (source  "DF0:")
  103.             (pattern "~(s|frost.s)")
  104.             (dest #VDATDIR)
  105.             (optional fail force)
  106.         )
  107.     ))
  108.  
  109.     ;
  110.     ; Check the main data file was created and
  111.     ; that we know this version of the game
  112.     ;
  113.     (P_SetVersionInfo)
  114.  
  115.     (if (= 0 #VVERINFA)
  116.         (abort
  117.             (cat    "\n*** UNKNOWN VERSION OF GAME! ***\n\n"
  118.                     "The installer does not recognise the version of the\n"
  119.                     "game that you are trying to install.\n\n"
  120.                     "Please contact the author for further information\n"
  121.             )
  122.         )
  123.     )
  124.  
  125.     (if (= -1 #VVERINFA)
  126.         (abort
  127.             (cat    "\n*** DATA FILES NOT CREATED! ***\n\n"
  128.                     "The installer could not extract the game data files.\n\n"
  129.                     "Please contact the author for further information\n"
  130.             )
  131.         )
  132.     )
  133.  
  134. ))
  135.  
  136. ;------------------------------------------------------------------------------------
  137. ; Install WHDLoad slave program
  138.  
  139. (procedure P_InstallSlave (
  140.  
  141.     (working "Installing slave program")
  142.  
  143.     ; copy slave program
  144.     (set #VT1 "Slave")
  145.     (if (>= #VVERINFA 0) (set #VT1 (cat #VT1 #VVERINFA)) )
  146.     (if (>= #VVERINFB 0) (set #VT1 (cat #VT1 #VVERINFB)) )
  147.     (if (>= #VVERINFC 0) (set #VT1 (cat #VT1 #VVERINFC)) )
  148.  
  149.     (copyfiles
  150.         (prompt "Copying slave program")
  151.         (help @copyfiles-help)
  152.         (source #VT1)
  153.         (newname #CFG_APPSLV)
  154.         (dest #VDESTDIR)
  155.         (nogauge)
  156.         (optional fail force)
  157.     )
  158.  
  159.     ; copy GUI program if present
  160.     (if (= 1 (exists "GUI"))(
  161.         (copyfiles
  162.             (prompt "Copying GUI program")
  163.             (help @copyfiles-help)
  164.             (source  "GUI")
  165.             (newname #CFG_APPGUI)
  166.             (dest #VDESTDIR)
  167.             (nogauge)
  168.             (optional fail force)
  169.         )
  170.     ))
  171.  
  172.     ; see if the user wants or needs to install an icon
  173.  
  174.     (set #VT1 (cat #CFG_APPGUI ".info"))
  175.     (if (= 0 (exists (tackon #VDESTDIR #VT1)))(
  176.         ; no icon exists, quietly copy one in
  177.         (set #VT2 1)
  178.     )(
  179.         ; icon exists, ask user if they want to overwrite it
  180.         (set #VT2
  181.             (askbool
  182.                 (prompt (cat "Do you want to replace the \"" #CFG_APPGUI "\" icon (recommended) ?"))
  183.                 (default 1)
  184.                 (help @askchoice-help)
  185.             )
  186.         )
  187.     ))
  188.  
  189.     ; install the icon if required
  190.     (if (= 1 #VT2)(
  191.         ; get choice of icon format
  192.         (set #VT3
  193.             (askchoice
  194.                 (prompt "Which type of icon would you like to install?")
  195.                 (choices "Standard" "NewIcon" "OS3.5+ Coloricon")
  196.                 (help @askchoice-help)
  197.             )
  198.         )
  199.         (if (= 0 #VT3) (set #VT3 ".oi"))
  200.         (if (= 1 #VT3) (set #VT3 ".ni"))
  201.         (if (= 2 #VT3) (set #VT3 ".ci"))
  202.  
  203.         ; install the icon
  204.         (copyfiles
  205.             (prompt "Copying icon")
  206.             (help @copyfiles-help)
  207.             (source (cat "Icon" #VT3))
  208.             (newname #VT1)
  209.             (dest #VDESTDIR)
  210.             (nogauge)
  211.             (optional fail force)
  212.         )
  213.     ))
  214. ))
  215.  
  216. ;------------------------------------------------------------------------------------
  217. (welcome (cat "Welcome to the " #CFG_APPNAME " HD Installer"))
  218.  
  219. ;
  220. ; Initialise
  221. ;
  222. (set @app-name #CFG_APPNAME)
  223. (set #VOLDEXEDIR @execute-dir)
  224. (set #VVERINFA -1)
  225. (set #VVERINFB -1)
  226. (set #VVERINFC -1)
  227. (set #VDESTDIR @default-dest)
  228.  
  229. ;
  230. ; Check settings
  231. ;
  232. (if    (<> @user-level 2)
  233.     (abort "You must select 'Expert' user level")
  234. )
  235.  
  236. (if    (< @installer-version 2818051)
  237.     (abort "This product requires at least version 43.3 of the Installer program")
  238. )
  239.  
  240. ;
  241. ; Check required programs are available
  242. ;
  243. (set #VP1 "WHDLoad")
  244. (P_CheckRun)
  245.  
  246. ;
  247. ; Welcome message
  248. ;
  249. (message "\n\n\nWelcome to the " #CFG_APPNAME " HD Installer " #CFG_APPVER "\n\n"
  250.          "© " #CFG_APPCOPY " Halibut Software\n\n"
  251.          "Please read the documentation thoroughly "
  252.          "before attempting to use this installer!\n\n"
  253.          "Click 'Proceed' to begin..."
  254. )
  255.  
  256. ;
  257. ; Get directory to install in
  258. ;
  259. (set #VDESTDIR
  260.     (askdir
  261.         (prompt "Where would you like the game installed?\n"
  262.                 "If you have an existing installation select that directory,\n"
  263.                 "otherwise create / select the directory to install the game into."
  264.         )
  265.         (help @askdir-help)
  266.         (default @default-dest)
  267.         (disk)
  268.         (newpath)
  269.     )
  270. )
  271. (set #VDESTDIR (expandpath #VDESTDIR))
  272. (set @default-dest #VDESTDIR)
  273. (set #VDATDIR  (tackon #VDESTDIR "data/"))
  274.  
  275. ;
  276. ; Create the installation directories
  277. ;
  278. (P_InstallDirs)
  279.  
  280. ;
  281. ; Install the game data
  282. ;
  283. (P_InstallGame)
  284.  
  285. ;
  286. ; Install the slave
  287. ;
  288. (P_InstallSlave)
  289.  
  290. ;==================================================================
  291. ;$VER: Frost Byte Installer script R0501.1 © 2001 Halibut Software